﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using XtremBiking.Web.Atributes;

namespace XtremBiking.Web.Models.Usuarios
{
    /// <summary>
    /// Public class responsible for sharing the presentation model to change back office user password (with validation at model level concerned) to be used in the GUI and to iterate with the facade of BackOffice
    /// </summary>
    [IsDifferent("CurrentPassword", "NewPassword", ErrorMessageResourceName = "PasswordAndNewPasswordMustBeDifferents", ErrorMessageResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
    public class UserChangePassword
    {
        /// <summary>
        /// Gets or sets user current password
        /// </summary>
        [Required(AllowEmptyStrings = false, ErrorMessageResourceName = "CurrentPasswordRequired", ErrorMessageResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        [DataType(DataType.Password)]
        [Display(Name = "DisplayCurrentPassword", ResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        public string CurrentPassword { get; set; }

        /// <summary>
        /// Gets or sets user new password
        /// </summary>
        [Required(AllowEmptyStrings = false, ErrorMessageResourceName = "NewPasswordRequired", ErrorMessageResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        [StringLength(50, MinimumLength = 6, ErrorMessageResourceName = "DisplayMinimumPasswordValidation", ErrorMessageResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        [DataType(DataType.Password)]
        [Display(Name = "DisplayNewPassword", ResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        public string NewPassword { get; set; }

        /// <summary>
        /// Gets or sets user confirm new password
        /// </summary>
        [Required(AllowEmptyStrings = false, ErrorMessageResourceName = "NewPasswordConfirmationRequired", ErrorMessageResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        [DataType(DataType.Password)]
        [Display(Name = "DisplayNewPasswordConfirmation", ResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        [System.ComponentModel.DataAnnotations.CompareAttribute("NewPassword", ErrorMessageResourceName = "PasswordAndConfirmationNotMatch", ErrorMessageResourceType = typeof(XtremBiking.Recursos.Modelos.Usuarios.UserChangePassword))]
        public string ConfirmNewPassword { get; set; }

    }
}
